/**
 * @file xgame_ary.h
 *
 */

#ifndef XGAME_ARY
#define XGAME_ARY

#ifdef __cplusplus
extern "C" {
#endif

/*********************
 *      INCLUDES
 *********************/
#include <stdint.h>

/*********************
 *      DEFINES
 *********************/

/**********************
 *      TYPEDEFS
 **********************/

/**********************
 * GLOBAL PROTOTYPES
 **********************/

/**
 * the non-zero numbers in the array are sequentially shifted to the left
 * @param ary      array
 * @param count    array length
 * @return         next position for non-zero numbers
 */
uint16_t *ary_merge_to_left(uint16_t *ary, uint16_t count);

 /**
 * merge the same numbers in the array sequentially to the left
 * @param ary      an array without zero values
 * @param count    array length
 * @return         merge End Next Position
 */
 uint16_t *ary_combine_to_left(uint16_t *ary, uint16_t count);

 /**
 * get the maximum value in the array
 * @param ary      array
 * @param count    array length
 * @return         next position for non-zero numbers
 */
uint16_t ary_get_max(const uint16_t *ary, uint16_t count);

 /**
 * get the minimum value in the array
 * @param ary      array
 * @param count    array length
 * @return         next position for non-zero numbers
 */
uint16_t ary_get_min(const uint16_t *ary, uint16_t count);

 /**
 * convert a right to left array to a left to right array
 * @param left     array from left to right
 * @param right    array from right to left
 * @param count    array length
 * @return         void
 */
void ary_cpy_r2l(uint16_t *left, const uint16_t *right, uint16_t count);
 /**
 * convert an array from left to right to a right to left array
 * @param right    array from right to left
 * @param left     array from left to right
 * @param count    array length
 * @return         void
 */
void ary_cpy_l2r(uint16_t *right, const uint16_t *left, uint16_t count);

/**********************
 *      MACROS
 **********************/


#ifdef __cplusplus
} /*extern "C"*/
#endif

#endif /*XGAME_ARY*/
